<?php
session_start();

include './common/functions.php';
include_once './common/Db.class.php';

$count = Db::query("select count(*) cn from msg");

//获取数组长度
$count = $count[0]['cn'];
//定义一个页要几个
$num   = 10;
//计算总共要多少页
$total = ceil($count/$num);

   // 条件 ? 成立 : 不成立 ;
// 获取url是的参数，知道要第几页
$p = isset($_GET['p']) ? $_GET['p'] : 1;
// 三元表达式
// 计算开始值 
$start = ($p-1)*$num;
//  获取一部分

$oldData = Db::query("select t1.*,t2.username from msg t1 inner join user t2 on t1.uid=t2.uid order by ctime desc limit {$start},{$num}"); 

include "./temp/index.html";